Skip to content

feat: include called service URI in StatusRuntimeException description#652

Closed
He-Pin wants to merge 1 commit intoapache:mainfrom
He-Pin:port/5-service-uri-in-exception
Closed

feat: include called service URI in StatusRuntimeException description#652
He-Pin wants to merge 1 commit intoapache:mainfrom
He-Pin:port/5-service-uri-in-exception

Conversation

@He-Pin
Copy link
Member

@He-Pin He-Pin commented Mar 8, 2026

Motivation

When a gRPC call fails, the StatusRuntimeException description only contained the raw gRPC status message. In systems with multiple services, it was difficult to tell which service caused the failure, particularly for generic error codes like UNAVAILABLE or CANCELLED.

Modification

  • Added requestUri: Uri as a first parameter to the internal PekkoHttpClientUtils.responseToSource, mapToStatusException, and parseResponseStatus methods
  • Appended "When calling rpc service: <URI>" to the exception description via Status.augmentDescription() in both branches of mapToStatusException (the "no grpc-status" and "non-zero status code" paths)
  • Updated PekkoHttpClientUtilsSpec tests to pass requestUri to all responseToSource calls
  • Updated PekkoGrpcScalaClientTester interop test assertion to use startsWith (since the description now has an appended URI suffix)
  • Added MiMa backwards-compatibility filter for the changed internal responseToSource signature

Result

Error messages now include the called service URI, making debugging significantly easier:

UNAVAILABLE: connection refused. When calling rpc service: https://myservice.example.com/my.Service/Method

Note: PR #646 by @pjfanning independently migrates the same upstream change. This PR is provided for migration traceability purposes.

References

Port upstream akka/akka-grpc@82e0413e.

Add the request URI to the StatusRuntimeException description via
augmentDescription so that callers can easily identify which service
caused the failure. Add MiMa filter for the changed responseToSource
signature (internal API).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pjfanning
Copy link
Member

@He-Pin this is a duplicate of #646

@raboof has highlighted some security concerns in that PR.

I can fix up #646 if it is agreed how to proceed but at the moment, I agree with @raboof that we shouldn't make exactly the Akka change.

@He-Pin He-Pin closed this Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants